package org.yray.sip.handler.flow;


import lombok.extern.slf4j.Slf4j;
import org.yray.sip.base.MsgEle;
import org.yray.sip.base.RegexUtils;
import org.yray.sip.base.SipMsg;
import org.yray.sip.handler.MessageHandler;
import org.yray.sip.server.SipServerContext;
import org.yray.sip.system.NoticeContext;


@Slf4j
public class OK_RegisterHandler extends MessageHandler {

    public static final OK_RegisterHandler instance=new  OK_RegisterHandler();

    @Override
    public String[] handler(SipMsg sipMsg, SipServerContext ssc) {
        //注册成功的
       String ext= RegexUtils.findExt(sipMsg.getMsgLine(MsgEle.CONTACT));
       ssc.getSipExtTable().addExtNo(ext);
       ssc.notice(NoticeContext.newNoticeContext().info(ext));
       return BLANK_STRINGS;
    }
}
